package com.hoshiicloud.common.constant;

/**
 * 订单状态
 * 99-全部
 * 0 -已取消
 * 1 -待付款
 * 2 -待发货
 * 3 -待收货
 * 4 -已关闭 待发货和待收货 所有商品全部都已退款完成变为已关闭状态
 * 5 -已完成
 * 88-待评价
 *
 * @author: zhangshuhu
 * @descripton: 订单状态枚举
 * @date: 14:37 2019/5/27
 */
public enum OrderStatusEnum {
    // 订单状态 0，未确认；1，已确认；2，已支付 3 分配中 4-已出货  5-已收货 6--售后 7-部分售后 8-已结算
    ALL_STATUS(99, "全部"),
    UN_COMMENT(88, "待评价"),
    CANCELLED(0,"已取消"),
    CONFIRMED(1,"已确认"),
    PAID(2,"已支付"),
    UN_SHIPPED(3,"分配中"),
    SHIPPED(4,"已出货"),
    RECEIVED(5,"已收货"),
    SOLD_OUT(6,"售后"),
    PART_SOLD_OUT(7,"部分售后"),
    SETTLED(8,"已结算");
//    CANCELLED(0, "已取消"),
//    UN_PAID(1, "已确认"),
//    ORDER_UN_SHIPPED(2,"翼支付"),
//    UN_SHIPPED(0, "待发货"),
//    SHIPPED(1, "配送中"),
//    UN_RECEIVED(3, "待收货"),
//    CLOSED(4, "已关闭"),
//    TRADE_SUCCESS(5, "已完成"),
//    UN_VERIFICATION(3, "待核销"),
//    VERIFICATION(4, "已核销");
    private int code;

    private String name;

    OrderStatusEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return this.code;
    }

    public String getName() {
        return this.name;
    }

    public static OrderStatusEnum get(int code) {
        for (OrderStatusEnum aparameterStatus : values()) {
            if (aparameterStatus.getCode() == code) {
                return aparameterStatus;
            }
        }
        return null;
    }

}
